# 此程序可以将wgs84坐标系下的经纬度转换为UTM50的x,y坐标
from pyproj import Proj, transform
import math
 
# 定义WGS84的经纬度投影和UTM投影
wgs84 = Proj(proj='latlong', datum='WGS84')
utm50 = Proj(proj='utm', zone=50, datum='WGS84')
 
# 定义转换函数
def convert_latlon_to_utm(lat, lon):
    x, y = transform(wgs84, utm50, lon, lat)
    return x, y
 
# 示例：转换一个经纬度点
# longitude = 114.03  # 例如，安阳矿的一个经度点
# latitude = 36.09  # 例如，安阳矿的一个纬度点

longitude = 119.13859253359757  # 例如，溧水矿卸载位经度
latitude = 31.462448100698257  # 例如，溧水矿卸载位纬度
x_offset = 703282.786
y_offset = 3482947.703

x_temp = -89.574203173
y_temp = -113.6092841011



x, y = convert_latlon_to_utm(latitude, longitude)
dis = math.sqrt((x_temp - (x - x_offset))*(x_temp - (x - x_offset)) + (y_temp - (y - y_offset))*(y_temp - (y - y_offset)))
print(f"原始x,y坐标: (Easting, Northing): ({x}, {y})")
print(f"减去偏移量后的x,y坐标: (Easting, Northing): ({x-x_offset}, {y-y_offset})")
print(f"4月9日的卸载位x,y坐标: (Easting, Northing): ({x_temp}, {y_temp})")
print(f"卸载位前后移动的距离: ({dis})")